package mc.support.task.msg;

/**
 * Created with IntelliJ IDEA. <br/>
 * Author: Francis Yun    <br/>
 * Date: 2014-09-17  <br/>
 */
public class Message<Offer, Reply> {

    private final MessageGroup<Offer, Reply> group;
    private Offer offer;
    private Reply reply;
    private boolean replied = false;

    Message(MessageGroup<Offer, Reply> group) {
        this.group = group;
    }

    public Message<Offer, Reply> offer(Offer offer) {
        this.offer = offer;
        return this;
    }

    public Message<Offer, Reply> reply(Reply reply) {
        this.reply = reply;
        group.replyCountUp();
        replied = true;
        return this;
    }

    public boolean isReplied() {
        return replied;
    }

    public Offer offered() {
        return offer;
    }

    public Reply replied() {
        return reply;
    }

}
